package Cn.Sarkar.MMS.Entities.Independent

import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.Core.Extensions.hasOne
import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.IDataContext
import Cn.Sarkar.MMS.DataBaseDefinations.Independent.Companies
import Cn.Sarkar.Entities.MMS.Additional.IContacts
import Cn.Sarkar.Entities.MMS.Additional.ICountry
import Cn.Sarkar.Entities.Common.Additional.IDescription
import Cn.Sarkar.Entities.Common.Additional.IName
import Cn.Sarkar.MMS.Entities.Additional.Contact
import Cn.Sarkar.MMS.Entities.Additional.Country
import Cn.Sarkar.MMS.Entities.Additional.Description
import Cn.Sarkar.MMS.Entities.Additional.Name
import Cn.Sarkar.Entities.Common.BaseEntity
import Cn.Sarkar.Entities.MMS.Independent.IApplication
import Cn.Sarkar.Entities.MMS.Independent.ICompany
import Cn.Sarkar.Entities.MMS.Independent.IPerson
import java.util.*

class Company(DataContext: IDataContext) : BaseEntity(DataContext, Companies), ICompany {
    var nameID by Companies.NameID
    override var name: IName by hasOne(Companies.NameID) { Name(it) }
    var descriptionID by Companies.DescriptionID
    override var description: IDescription by hasOne(Companies.DescriptionID) { Description(it) }
    var contactID by Companies.ContactID
    override var contacts: IContacts by hasOne(Companies.ContactID) { Contact(it) }
    var parentID by Companies.ParentID
    override var parent: ICompany? = null
    override var admins: MutableList<IPerson> = LinkedList()
    override var licenceNumber: String by Companies.LicenceNumber
    override var identificationCode: String by Companies.IdentificationCode
    var addrID by Companies.AddrID
    override var addr: ICountry by hasOne(Companies.AddrID) { Country(it) }
    override var applications: MutableList<IApplication> = LinkedList()
}